home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Macintosh Drag and Drop / Demo Applications / Dragster / DragText Sources / initialize.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-03  |  1.5 KB  |  96 lines  |  [TEXT/KAHL]

  1. /*
  2.  *
  3.  *        initialize.c
  4.  *
  5.  *        Initialization routines.
  6.  *        
  7.  *
  8.  *        Author:        Rob Johnston
  9.  *        Date:        Tuesday, February 25, 1992
  10.  *
  11.  *        12/30/94    JML        Code now compiles with Universal interfaces.
  12.  *        01/03/95    JML        Code now *works* with Universal interfaces.
  13.  *
  14.  *        Copyright © 1992 Apple Computer, Inc.
  15.  *
  16.  */
  17.  
  18. #include <Fonts.h>
  19. #include <Dialogs.h>
  20. #include <Drag.h>
  21. #include <GestaltEqu.h>
  22. #include <SegLoad.h>
  23. #include <TextUtils.h>
  24. #include "globals.h"
  25. #include "DTResources.h"
  26.  
  27.  
  28. void InitializeToolbox()
  29.  
  30. {    long            gestaltResponse;
  31.  
  32.     InitGraf(&qd.thePort);
  33.     InitFonts();
  34.     InitWindows();
  35.     InitMenus();
  36.     TEInit();
  37.     InitDialogs(0L);
  38.     InitCursor();
  39.  
  40.     MoreMasters();
  41.     MoreMasters();
  42.     MaxApplZone();
  43.  
  44.     FlushEvents(everyEvent, 0);
  45.  
  46.     if ((Gestalt(gestaltDragMgrAttr, &gestaltResponse) != noErr) ||
  47.         (!(gestaltResponse & (1 << gestaltDragMgrPresent)))) {
  48.  
  49.         Alert(512, 0L);
  50.         ExitToShell();
  51.     }
  52. }
  53.  
  54.  
  55. void InitializeGlobals()
  56.  
  57. {    Handle            theHandle;
  58.  
  59.     gQuit = gQuitting = false;
  60.     gDocumentCount = 0;
  61.     gFontItem = gSizeItem = 0;
  62.     gInBackground = false;
  63.     gCanUndoDrag = slCantUndo;
  64. }
  65.  
  66.  
  67. void DeallocateGlobals()
  68.  
  69. {
  70.     
  71. }
  72.  
  73.  
  74. void SetupMenus()
  75.  
  76. {    Handle        theMenuBar;
  77.     MenuHandle    theMenu;
  78.     Str255        theStr;
  79.  
  80.     if (! (theMenuBar = GetNewMBar(MenuBarID))) {
  81.         SysBeep(1);
  82.         ExitToShell();
  83.     }
  84.     SetMenuBar(theMenuBar);
  85.     DisposHandle(theMenuBar);
  86.  
  87.     AddResMenu(GetMHandle(idAppleMenu), 'DRVR');
  88.     AddResMenu(GetMHandle(idFontMenu), 'FONT');
  89.  
  90.     GetIndString(theStr, MenuStringsID, slCantUndo);
  91.     SetItem(GetMHandle(idEditMenu), iUndo, theStr);
  92.  
  93.     DrawMenuBar();
  94. }
  95.  
  96.